package com.gm.commonlib.views.dialog;

import android.content.ContentProvider;
import android.content.Context;
import android.content.DialogInterface;
import android.text.TextUtils;

public class DialogUtil {

    public static void showConnectionWeightFail(Context context){
        show(context,"连接失败,可以尝试如下\n" +
                "1.密码错误，密码一般为0000或1234\n" +
                "1.关闭平板蓝牙,再打开蓝牙\n" +
                "3.请重启蓝牙称\n"+
                "2.重启平板",null);
    }
    public static void show(Context context, String msg, DialogInterface.OnClickListener listener) {
       show(context,msg,null,null,null,listener);
    }


    public static void show(Context context, String msg,DialogInterface.OnClickListener leftListener, DialogInterface.OnClickListener listener) {
        show(context,msg,null,null,leftListener,listener);
    }




    public static void show(Context context, String msg,String left,String right,DialogInterface.OnClickListener leftListener, DialogInterface.OnClickListener listener) {
        CustomDialog dialog = new CustomDialog(context);
        dialog.setMessage(msg)
                .hiddenTitle()
                .setLeftText(TextUtils.isEmpty(left)?"取消":left)
                .setRightText(TextUtils.isEmpty(right)?"确定":right)
                .setOnRightListener(listener)
                .setOnLeftListener(leftListener)
                .show();
    }

    public static InputDialog showInputDialog(Context context,String title, String content, InputDialog.OnSubMitBtnClickListener listener) {
        InputDialog dialog = new InputDialog(context);
        dialog.setTitle(title);
        dialog.setConTentText(content)
                .initOnSubMitClickListener(listener)
                .showDialog();
        return dialog;
    }

    public static InputDialog showInputDialog(Context context,String title, String content,InputDialog.OnSubMitBtnClickListener canclelistener, InputDialog.OnSubMitBtnClickListener listener) {
        InputDialog dialog = new InputDialog(context);
        dialog.setTitle(title);
        dialog.setConTentText(content)
                .initOnSubMitClickListener(listener)
                .showDialog();

        return dialog;
    }




}
